<template>
<div>
  <h3>{{msg}}</h3>
  <form>
    账号：<input v-model="users.username" type="text"/><br/>
    密码：<input v-model="users.password" type="text"/><br/>
    <input type="button" value="登录" @click="login">
    <input type="button" value="重填">
  </form>
</div>
</template>

<script>
import instance from "../utils/request";

export default {
name: "login",
  data(){
      return {
        msg:"用户登录",
        users:{}
      };
  },
  methods:{
    login(){
      console.log("in login....");
      console.log(this.users);
      //发异步请求 检查账号密码
      instance.post("/user/login",this.user)
      .then(res=>{
        console.log(res.data);
      });
      /*//到主页显示
      this.$router.push({name:"welcome"});*/
    }
  }
}
</script>

<style scoped>

</style>
